import { Asset, assetManager } from "cc"

export class AssetPath{
    public static CONFIG: Map<string, string> = new Map<string, string>([
        ["lv", "configs/lv"],
        ["thing", "configs/thing"], 
        ["prefab_box", "prefab/ingame/box_01"],
        //toy type == 100
        ["toy_fish", "prefab/ingame/100/toy_cat"],
        ["toy_cat", "prefab/ingame/100/toy_cat"],
        ["toy_duck", "prefab/ingame/100/toy_duck"],
    ])
}

export class AssetLoadSync{
    public static async loadRes<T extends Asset>(respath: string) : Promise<T>{
        return new Promise<T>((resolve, reject)=>{
            assetManager.resources?.load<T>(respath, (err, ret)=>{
                if (err != null){
                    console.error("sync load res <%s> raise error!<%s>", respath, err)
                    return
                }
                resolve(ret)
            })
        })
        
    }
}

export let IngameRequireAsset = [
    "prefab/ingame/box_01"
]